www.mxdraw.com
内容索引主面
前一个向上下一个
IMxDrawPrint::BatchPrintDialog 方法

批量打印对话框

IDL
[helpstring("method BatchPrintDialog")]
HRESULT BatchPrintDialog([in] IMxDrawResbuf* pParam, [out,retval] VARIANT_BOOL* pOk);
参数 
说明 
[in] IMxDrawResbuf* pParam 
批量打印位置参数, 是个点数组,数组两个点表示一对,一对代表一个打印区域。 

成功返回True

例如: 代码实现

            MxDraw::MXDRAWOCXHANDLE hOcx = MxDraw::GetCurOcxHandle();
            if(hOcx == NULL)
            {
                MXASSERT(0);
                return NOERROR;
            }

            // TODO: 在此添加实现代码
            McGePoint3dArray aryPt;
            HRESULT hr = MxDrawXFun::IMxDrawResbufToMcGePoint3dArray(pParam,aryPt);
            if(FAILED(hr) )
            {
                return hr;
            }
            *pOk = VARIANT_FALSE;

            MxDraw::BATCH_PRINT_DATA vec;
            for(int i = 0;i + 1 < aryPt.length();i+=2)
            {
                MxDraw::stuBatchPrintData data;
                McGePoint3d pt1 = aryPt[i];
                McGePoint3d pt2 = aryPt[i+1];

                McDbExtents ext;
                ext.set(pt1,pt2);

                data.ptLB = ext.minPoint();
                data.ptRT = ext.maxPoint();
                data.iPrintDirection = m_iDirection;
                data.sLayoutName = m_sLayoutName;
                vec.push_back(data);
            }

            if(!vec.empty())
            {
                if(MxDraw::BatchPrintDialog(hOcx,vec) )
                {
                    *pOk = VARIANT_TRUE;
                }
            }

            return S_OK;

例如: VC COM

            IMxDrawPrintPtr print;
            print.CreateInstance(__uuidof( MxDrawPrint ));

            IMxDrawResbufPtr spData;
            spData.CreateInstance(__uuidof( MxDrawXLib::MxDrawResbuf ));

            IMxDrawPointPtr pt;
            pt.CreateInstance(__uuidof( MxDrawXLib::MxDrawPoint ));
            pt->x = 0.0;
            pt->y = 0.0;
            spData->AddPoint(pt);

            pt->x = 100.0;
            pt->y = 100.0;
            spData->AddPoint(pt);

            pt->x = 200.0;
            pt->y = 200.0;
            spData->AddPoint(pt);

            pt->x = 300.0;
            pt->y = 300.0;
            spData->AddPoint(pt);
            if(print->BatchPrintDialog(spData) )
            {
                AfxMessageBox(_T("Ok"));
            }
            else
            {
                AfxMessageBox(_T("Failed"));
            }

例如: JS代码。

      var pRet =mxOcx.Call("Mx_GetMcDbDatabaseBound", "");

    if (pRet.AtString(0) == "Ok") {
       
      var pt = mxOcx.NewPoint();
      pt.x =  pRet.AtDouble(1);
      pt.y =  pRet.AtDouble(2);
      
      var param = mxOcx.NewResbuf();
      param.AddPoint(pt);
      
      pt.x =  pRet.AtDouble(3);
      pt.y =  pRet.AtDouble(4);
      param.AddPoint(pt);
       
      var print = mxOcx.NewComObject("IMxDrawPrint");

      print.BatchPrintDialog(param);
     }
     else {
         alert("调用失败");
     }
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!